package com.example.nowcodercommunity;

import org.springframework.stereotype.Component;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.util.Date;
import java.util.concurrent.Callable;

public class test {
    public static void main(String[] args) {
        test test = new test();
        test.test();
    }

    public void test(){
        Class<? extends test> aClass = this.getClass();

        Annotation[] annotations = aClass.getAnnotations();

        for(Annotation annotation: annotations){
            System.out.println(annotation.annotationType().getName());
        }
    }
}

class thread1 extends Thread{
    private int num;

    public thread1(){
        this.num = 10;
    }

    @Override
    public void run() {
        for(int i=0;i<num;i++){
            System.out.println(Thread.currentThread().getClass().getName()+" "+i);
        }
    }
}

class thread2 implements Runnable{

    private int num;

    public thread2(){
        num = 10;
    }

    @Override
    public void run() {
        for(int i=0;i<num;i++){
            System.out.println(Thread.currentThread().getClass().getName()+" "+i);
        }
    }
}

class thread3 implements Callable<String>{
    @Override
    public String call() throws Exception {
        for(int i=0;i<10;i++){
            System.out.println(Thread.currentThread().getClass().getName()+" "+i);
        }
        return "Callable执行完毕";
    }
}
